package com.auroramanito.uaa.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import io.netty.util.concurrent.DefaultPromise;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@RequiredArgsConstructor
@Configuration
public class AliConfig {
    private final AppProperties appProperties;

    /**
     * 所选节点，key secret.
     * */
    @Bean
    public IAcsClient iAcsClient(){
        DefaultProfile profile = DefaultProfile.getProfile(
                "cn-hangzhou",
                appProperties.getAli().getApiKey(),
                appProperties.getAli().getApiSecret()
        );
        return new DefaultAcsClient(profile);
    }
}
